﻿<?php
  header("content-type:text/html;charset=utf-8");
  //导入配置文件
  require './Model.class/config.php';
  //require './Model.class/Model.class.php';
  
  //引入各个控制器
  //require'./Controllers.class/goods.controller.php';
  //获取用户参数
  //获取控制器名
  $c=empty($_GET['c'])? 'Index':$_GET['c'];
  //获取操作名
  $a=empty($_GET['a'])? 'index':$_GET['a'];    
  //拼接类名
  $classname =$c.'controller';
  
  //自动加载
  function __autoload($classname){
      //echo $classname;
      if (file_exists("./Model.class/{$classname}.class.php")){
          require "./Model.class/{$classname}.class.php";
      }else if(file_exists("./Controllers.class/{$classname}.php")){
          require "./Controllers.class/{$classname}.php"; 
      }else{
          header('HTTP/1.0 404 NOT FOUND');
          header('Status 404 NOT FOUND');
          echo '404 not found';
          die();
      }
      
  }
  //实例化控制器
  $controller= new $classname();
  
  //var_dump($controller);
  //调用控制器中的方法;
  $controller->$a();
?> 